package com.ss.android.lockscreen.activity.lock;

import android.content.Context;
import android.text.TextUtils;

import com.ss.android.common.applog.AppLog;
import com.ss.android.lockscreen.bb;

import org.json.JSONException;
import org.json.JSONObject;

import inline.ConnectionUtils;
import inline.NetworkDemo;
import inline.TextDemo;

final class r implements Runnable {
    public final n b;
    private final String c;
    public final Context a;

    r(n arg1, String arg2, Context arg3) {
        this.b = arg1;
        this.c = arg2;
        this.a = arg3;

    }

    private void a() {
        this.b.b.post(new u(this));
    }

    public final void run() {
        if (TextUtils.isEmpty(this.c)) {
            this.a();
            return;
        }

        if (bb.a().d == null) {
            this.a();
            return;
        }

        Context v1 = this.a;
        String v2 = this.c;
        StringBuilder v3 = new StringBuilder("http://open.snssdk.com/data/stream/v3/?");
        String v0 = "";
        if (bb.a().b != null) {
            v0 = AppLog.i();
            if (v0 == null) {
                v0 = "";
            }
        }

        if (!TextDemo.c(v0)) {
            v3.append("&litelock_uid=").append(v0);
        }

        v3.append("&category=screen_lock");
        v0 = NetworkDemo.a(ConnectionUtils.b(v1));
        if (!TextDemo.c(v0)) {
            v3.append("&ac=").append(v0);
        }

        v3.append("&min_behot_time=").append(String.valueOf(android.support.design.a.B.a.b("lock_last_stream_max_be_hot_time", System.currentTimeMillis() / 1000 - 10)));
        if (android.support.design.a.B.e() == 2) {
            v3.append("&little_video=").append(android.support.design.a.B.d());
        } else {
            v3.append("&little_video=false");
        }

        v3.append("&access_token=").append(v2);
        if (bb.a().c != null) {
            android.support.design.a.a(v3, "ss_apps", com.ss.android.lockscreen.aa.c().toString());
        } else {
            android.support.design.a.a(v3, "ss_apps", com.ss.android.lockscreen.aa.b().toString());
        }

        android.support.design.a.a(v3, v1);
        v0 = com.ss.android.lockscreen.e.e$c.a(v3.toString());
        if (TextDemo.c(v0)) {
            this.a();
            return;
        }

        try {
            JSONObject v1_1 = new JSONObject(v0);
            if (!android.support.design.a.b(v1_1)) {
                com.ss.android.lockscreen.utils.a.a("LockScreenLoader", "get article info error: " + v1_1);
                this.a();
                return;
            }

            this.b.b.post(new s(this, Boolean.valueOf(true), com.ss.android.lockscreen.http.data.a.a(v1_1)));
        } catch (JSONException v0_1) {
            this.a();
        }
    }
}

